﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;

namespace Wheels.Windows
{
    public static class Kernel32
    {
#pragma warning disable 1591

        public const string DllName = "Kernel32.DLL";

        public const int LOAD_LIBRARY_AS_DATAFILE = 0x00000002;

        [DllImport(DllName, SetLastError = true, CharSet = CharSet.Unicode)]
        public static extern IntPtr LoadLibraryEx(string lpFileName, IntPtr hFile, int flags);

        [DllImport(DllName)]
        public static extern IntPtr FindResource(IntPtr hModule, IntPtr id, IntPtr type);
        [DllImport(DllName, CharSet = CharSet.Unicode)]
        public static extern IntPtr FindResource(IntPtr hModule, IntPtr id, string type);
        [DllImport(DllName, CharSet = CharSet.Unicode)]
        public static extern IntPtr FindResource(IntPtr hModule, string name, IntPtr type);

        [Obsolete("Don't use unless you have encountered wired compatibility issue.")]
        [DllImport(DllName)]
        public static extern IntPtr FindResource(IntPtr hModule, int id, int type);
        [Obsolete("Don't use unless you have encountered wired compatibility issue.")]
        [DllImport(DllName, CharSet = CharSet.Unicode)]
        public static extern IntPtr FindResource(IntPtr hModule, int id, string type);
        [Obsolete("Don't use unless you have encountered wired compatibility issue.")]
        [DllImport(DllName, CharSet = CharSet.Unicode)]
        public static extern IntPtr FindResource(IntPtr hModule, string name, int type);

        [DllImport(DllName, CharSet = CharSet.Unicode)]
        public static extern IntPtr FindResource(IntPtr hModule, string name, string type);

        [DllImport(DllName, SetLastError = true)]
        public static extern IntPtr LoadResource(IntPtr hModule, IntPtr resHandle);

        [DllImport(DllName, SetLastError = true)]
        public static extern int SizeofResource(IntPtr hModule, IntPtr hResInfo);
    }
}
